package com.hongya.article4.book.controller;

import com.hongya.article4.book.domain.BookEntity;
import com.hongya.article4.book.jpa.BookRespsitory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping(value = "/book")
public class BookController {

    @Autowired
    private BookRespsitory bookRespsitory;
    /**
     * 查询书列表方法
     * @return
     */
    @RequestMapping(value ="/list" ,method = RequestMethod.GET)
    public List<BookEntity> list(){
        return bookRespsitory.findAll();
    }
}
